<?php
@mysql_pconnect($sql_host, $sql_login, $sql_pass);

@mysql_select_db ("$db")
?>
<table cellpadding="2" cellspacing="2" border="1">
  <tbody>
<?php
$q = stripslashes ($q);

$res = mysql_query("$q");
 @$arows = mysql_affected_rows() ;
if ($sel!=1)
{@$row = mysql_fetch_row($res);
  $x=0;
 while ($x<@mysql_num_fields($res)){
    
    echo  "<td>".mysql_field_name($res,$x)."<br>
      </td>";
      
   $x++;
   }
 
  $y=0;
 while ($y<@mysql_num_rows($res)){
  
   echo '<tr>';
   $x=0;
   while ($x<@mysql_num_fields($res)){
    
    echo  "<td>$row[$x]<br>
      </td>";
      
   $x++;
   }
 $row = @mysql_fetch_row($res);
 echo'</tr>';
 $y++;
 }  
 }  
?>
  </tbody>
</table>
 <br>
 <?php
 @$rows = @mysql_num_rows($res) ;
 if ($rows) {echo '<br>'.$rows.'  rows  '; }     

  if ($arows) {echo '<br>'.$arows.'  affected rows  '; }

 echo '<br>errors: '.mysql_errno() .": ". mysql_error()   ;
 ?>
<br>
<form method="post" action="sql.php">

<input type="text" name="q" value="<?php  echo $q;?>" style="width:100%;">
<br><input type="submit" name="submit" value="--------------------">
<br><input type="text" name="db" value="<?php echo $db;?>"> use base
<br>
-------------------------------------------------------------
<br><input type="text" name="sql_host" value="<?php echo $sql_host;?>"> sql_host
<br><input type="text" name="sql_login" value="<?php echo $sql_login;?>"> sql_login
<br><input type="text" name="sql_pass" value="<?php echo $sql_pass;?>"> sql_pass

</form>

